<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8"/>
    <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7"/>
    <title>琦琦首页</title>
</head>

<body>
<!-- 头部栏位 -->
<!--页面顶部-->
<div class="input-append">
    <input id="autocomplete" type="text" value="请输入你想查询的城市" class="input-error input-xxlarge"/>
    <button class="sui-btn btn-xlarge btn-danger"
            onclick="selectWatch($('#autocomplete').val())" type="button">天气搜索
    </button>

    <tr>
    <ul id="Weather">

    </ul>
    </tr>
</div>
</body>

<!--侧栏面板结束-->
<script type="text/javascript" src="/js/jquery-2.1.1.min.js"></script>
<script type="text/javascript">


    $(function () {
        toIndex();
    })

    $(function(){

    });
    //轮播图
    function toIndex() {
        $.ajax({
            url: "/",
            type: "get",
            dataType: "json",
            success: function (result) {
            },
            error: function (result) {
            }
        })
    }






    function selectByTelet(text) {
        alert(text)
        location.href = "/ip/IpWeatherMessage?city=" + text
    }

    //天气预报
    function selectWatch(text) {

        $.get("/ip/IpWeatherMessage?city="+text, function (result) {
            console.log(result)
            if (result.status == 0) {
                var data= result.result
                var list = data.index[0]

                var html = '';
                html += '<li class="f-item">城市：' + data.city + '</li>\n' +
                    '\t\t\t\t\t\t<li class="f-item">天气：' + data.weather + '</li>\n' +
                    '\t\t\t\t\t\t<li class="f-item">温度：' + data.temp + ' C°</li>\n' +
                    '\t\t\t\t\t\t<li class="f-item">风向：' + data.winddirect + '</li>\n' +
                    '\t\t\t\t\t\t<li class="f-item">风速：' + data.windpower + '</li>\n' +
                    '\t\t\t\t\t\t<li class="f-item">时间：' + data.updatetime + '</li>\n' +

                    '\t\t\t\t\t\t<li class="f-item">星期：' + data.week + '</li>\n' +
                    '\t\t\t\t\t\t<li class="f-item">湿度：' + data.windspeed + ' C°</li>';
                $("#Weather").html(html);
            } else {
                alert(result.msg);
            }
        }, "json")
    }

</script>


</html>